static double *polybufz;
static const char *ofname;
static int nameidx;
+static int urlidx;
static char *opt_name = NULL;
+static char *opt_url = NULL;
static
arglist_t shp_args[] = {
{"name", &opt_name, "Index of name field in .dbf",
+ NULL, ARGTYPE_STRING, "0", NULL },
+ {"url", &opt_url, "Index of URL field in .dbf",
NULL, ARGTYPE_INT, "0", NULL },
ARG_TERMINATOR
};
// fatal(MYNAME ":dbf file for %s doesn't have 'NAME' field.\n Please specify the name index with the 'name' option.\n", fname);
}
}
+ if ( opt_url ) {
+ urlidx = atoi( opt_url );
+ }
+ else {
+ urlidx = DBFGetFieldIndex( ihandledb, "URL" );
+ }
}
void
SHPObject *shp;
waypoint *wpt;
const char *name;
+ const char *url;
char *tmpName = NULL;
char *tmpIndex = opt_name;
name = tmpName;
}
}
+ if ( urlidx > 0 ) {
+ url = DBFReadStringAttribute( ihandledb, npts-1, urlidx);
+ }
+ else {
+ url = NULL;
+ }
+
if (shp->nSHPType == SHPT_ARC) {
int j;
route_head *track_head = route_head_alloc();
wpt->latitude = shp->dfYMin;
wpt->longitude = shp->dfXMin;
wpt->shortname = xstrdup(name);
+ if ( url ) {
+ wpt->url = xstrdup(url);
+ }
waypt_add(wpt);
}